<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style>
*{margin:0;padding:0;}

</style>
</head>

<body>
	<script>
		
		//创建table
		var table=document.createElement('table');
		
		table.border=1;
		
		table.width='100%';
		
		//创建tBody
		var tbody=document.createElement('tbody');
		table.appendChild(tbody);
		
		//创建第一行
		tbody.insertRow(0);
		tbody.rows[0].insertCell(0);
		tbody.rows[0].cells[0].appendChild(document.createTextNode('Cell 1,1'));
		
		tbody.rows[0].insertCell(1);
		tbody.rows[0].cells[1].appendChild(document.createTextNode('Cell 2,1'));
		
		//创建第二行
		tbody.insertRow(1);
		tbody.rows[1].insertCell(0);
		tbody.rows[1].cells[0].appendChild(document.createTextNode('Cell 1,2'));
		
		tbody.rows[1].insertCell(1);
		tbody.rows[1].cells[1].appendChild(document.createTextNode('Cell 2,2'));
		
		
		document.body.appendChild(table);		
    </script>
</body>
</html>
